package di.scanner.producer;

import di.scanner.store.FileStore;
import di.scanner.store.XMLStore;

import java.io.File;

public class FileProducer implements Producer<File> {

    public final static String END_FILE = "end file";

    @Override
    public void produce(File file) {
        if (file==null){
            FileStore.getInstance().add(END_FILE);
            return;
        }
        if (!file.exists())
            return;
        if (file.getName().endsWith("java")&&(!file.getName().endsWith("Test.java"))&&(!file.getName().endsWith("IT.java"))&&(!file.getName().endsWith("Tester.java"))){
            System.out.println(file.getAbsolutePath());
            FileStore.getInstance().add(file.getAbsolutePath());
        }if("soaProxyConfigurations.xml".equals(file.getName())){
            System.out.println(file.getAbsolutePath());
            XMLStore.getInstance().add(file.getAbsolutePath());
        }
    }

}
